package tw.BBT.BasalBodyTemperature.Components.Common;

import tw.BBT.BasalBodyTemperature.*;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public	class PopUp_TextPicker {
		
		// 跟 Entry 溝通的位址
		BasalBodyTemperature BBT;
		
		LayoutInflater BBTLayout;
		View PopUpTextPickerLayout;
		TextView TextPicker_Message;
		EditText TextPicker_TextInput; 
		Button TextPicker_Apply, TextPicker_Cancel;

		public PopUp_TextPicker(Context context) {
			this.BBT = (BasalBodyTemperature)context;
			BBTLayout = LayoutInflater.from(this.BBT);
			PopUpTextPickerLayout = BBTLayout.inflate(R.layout.popup_textpicker, null);
			TextPicker_Message = (TextView)PopUpTextPickerLayout.findViewById(R.id.PopUp_TextPicker_Message);
			TextPicker_TextInput = (EditText)PopUpTextPickerLayout.findViewById(R.id.PopUp_TextPicker_InputText);
			TextPicker_Apply = (Button)PopUpTextPickerLayout.findViewById(R.id.PopUp_TextPicker_Apply);
			TextPicker_Cancel = (Button)PopUpTextPickerLayout.findViewById(R.id.PopUp_TextPicker_Cancel);
		}
		
		public void setTextPicker_Message(CharSequence mess) {
			TextPicker_Message.setText(mess);
		}
		
		public void setTextPicker_TextInput(CharSequence name) {
			TextPicker_TextInput.setText(name);
		}
		
		public void setListener(View.OnClickListener clickListener) {
			TextPicker_Apply.setOnClickListener(clickListener);
			TextPicker_Cancel.setOnClickListener(clickListener);
		}
		
		public View getView() {
			return PopUpTextPickerLayout;
		}
		
		public CharSequence getTextPicker_TextInput() {
			return TextPicker_TextInput.getText().toString().trim();
		}
	}